package com.ruifu.pls.entity;


import com.ruifu.pls.model.odoReturn.GLDocOrderPackingSummary;
import com.ruifu.pls.model.odoReturnConform.GLPackages;

import javax.persistence.*;
import java.util.Date;

/**
 * AbstractDocOrderPackingSummary entity provides the base persistence
 * definition of the DocOrderPackingSummary entity. @author MyEclipse
 * Persistence Tools
 */
@Entity
@Table(name = "doc_order_packing_summary")
@IdClass(DocOrderPackingSummaryId.class)
public class DocOrderPackingSummary implements
        java.io.Serializable {

    private DocOrderPackingSummaryId id;
    private String cartongroup;
    private Double grossweight;
    private Double cubic;
    private Double qty;
    private String udf1;
    private String udf2;
    private String udf3;
    private String udf4;
    private String udf5;
    private Date addtime;
    private String addwho;
    private Date edittime;
    private String editwho;
    private String deliveryno;
    private Double length;
    private Double width;
    private Double height;
    private String returnrefno;
    private Double billingweight;
    private Double standardweight;
    private String traceid;
    private String orderno;

    // Constructors

    /** default constructor */
    public DocOrderPackingSummary() {
    }

    /** minimal constructor */
    public DocOrderPackingSummary(DocOrderPackingSummaryId id,
                                          Date addtime, Date edittime) {
        this.id = id;
        this.addtime = addtime;
        this.edittime = edittime;
    }

    /** full constructor */
    public DocOrderPackingSummary(DocOrderPackingSummaryId id,
                                          String cartongroup, Double grossweight, Double cubic, Double qty,
                                          String udf1, String udf2, String udf3, String udf4, String udf5,
                                          Date addtime, String addwho, Date edittime, String editwho,
                                          String deliveryno, Double length, Double width, Double height,
                                          String returnrefno, Double billingweight, Double standardweight) {
        this.id = id;
        this.cartongroup = cartongroup;
        this.grossweight = grossweight;
        this.cubic = cubic;
        this.qty = qty;
        this.udf1 = udf1;
        this.udf2 = udf2;
        this.udf3 = udf3;
        this.udf4 = udf4;
        this.udf5 = udf5;
        this.addtime = addtime;
        this.addwho = addwho;
        this.edittime = edittime;
        this.editwho = editwho;
        this.deliveryno = deliveryno;
        this.length = length;
        this.width = width;
        this.height = height;
        this.returnrefno = returnrefno;
        this.billingweight = billingweight;
        this.standardweight = standardweight;
    }

    // Property accessors
    public GLDocOrderPackingSummary glDocOrderPackingSummary = new GLDocOrderPackingSummary();
    public GLPackages glPackages = new GLPackages();


    @Id
    @Column(name = "ORDERNO", nullable = false, length = 20)
    public String getOrderno() {
        return this.orderno;
    }

    public void setOrderno(String orderno) {
        this.orderno = orderno;
    }
    @Id
    @Column(name = "TRACEID", nullable = false, length = 30)
    public String getTraceid() {
        return this.traceid;
    }

    public void setTraceid(String traceid) {
        this.traceid = traceid;
        if(traceid==null){
            this.glDocOrderPackingSummary.setPackageCode(getOrderno());
            this.glPackages.setPackageCode(getOrderno());

        }
        else{
            this.glDocOrderPackingSummary.setPackageCode(getTraceid());
            this.glPackages.setPackageCode(getTraceid());

        }

    }

    public void setId(DocOrderPackingSummaryId id) {
        this.id = id;
    }

    @Column(name = "CARTONGROUP", length = 10)
    public String getCartongroup() {
        return this.cartongroup;
    }

    public void setCartongroup(String cartongroup) {
        this.cartongroup = cartongroup;
    }

    @Column(name = "GROSSWEIGHT", precision = 18, scale = 8)
    public Double getGrossweight() {
        return this.grossweight;
    }

    public void setGrossweight(Double grossweight) {

        this.grossweight = grossweight;
        this.glPackages.setWeight(getGrossweight().toString());
    }

    @Column(name = "CUBIC", precision = 18, scale = 8)
    public Double getCubic() {
        return this.cubic;
    }

    public void setCubic(Double cubic) {
        this.cubic = cubic;
        this.glPackages.setVolume(getCubic().toString());

    }

    @Column(name = "QTY", precision = 18, scale = 8)
    public Double getQty() {
        return this.qty;
    }

    public void setQty(Double qty) {
        this.qty = qty;
    }

    @Column(name = "UDF1", length = 400)
    public String getUdf1() {
        return this.udf1;
    }

    public void setUdf1(String udf1) {
        this.udf1 = udf1;
    }

    @Column(name = "UDF2", length = 400)
    public String getUdf2() {
        return this.udf2;
    }

    public void setUdf2(String udf2) {
        this.udf2 = udf2;
    }

    @Column(name = "UDF3", length = 400)
    public String getUdf3() {
        return this.udf3;
    }

    public void setUdf3(String udf3) {
        this.udf3 = udf3;
    }

    @Column(name = "UDF4", length = 400)
    public String getUdf4() {
        return this.udf4;
    }

    public void setUdf4(String udf4) {
        this.udf4 = udf4;
    }

    @Column(name = "UDF5", length = 400)
    public String getUdf5() {
        return this.udf5;
    }

    public void setUdf5(String udf5) {
        this.udf5 = udf5;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "ADDTIME", nullable = false, length = 7)
    public Date getAddtime() {
        return this.addtime;
    }

    public void setAddtime(Date addtime) {
        this.addtime = addtime;
    }

    @Column(name = "ADDWHO", length = 35)
    public String getAddwho() {
        return this.addwho;
    }

    public void setAddwho(String addwho) {
        this.addwho = addwho;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "EDITTIME", nullable = false, length = 7)
    public Date getEdittime() {
        return this.edittime;
    }

    public void setEdittime(Date edittime) {
        this.edittime = edittime;
    }

    @Column(name = "EDITWHO", length = 35)
    public String getEditwho() {
        return this.editwho;
    }

    public void setEditwho(String editwho) {
        this.editwho = editwho;
    }

    @Column(name = "DELIVERYNO", length = 50)
    public String getDeliveryno() {
        return this.deliveryno;
    }

    public void setDeliveryno(String deliveryno) {
        this.deliveryno = deliveryno;
    }

    @Column(name = "LENGTH", precision = 18, scale = 8)
    public Double getLength() {
        return this.length;
    }

    public void setLength(Double length) {
        this.length = length;
    }

    @Column(name = "WIDTH", precision = 18, scale = 8)
    public Double getWidth() {
        return this.width;
    }

    public void setWidth(Double width) {
        this.width = width;
    }

    @Column(name = "HEIGHT", precision = 18, scale = 8)
    public Double getHeight() {
        return this.height;
    }

    public void setHeight(Double height) {
        this.height = height;
    }

    @Column(name = "RETURNREFNO", length = 20)
    public String getReturnrefno() {
        return this.returnrefno;
    }

    public void setReturnrefno(String returnrefno) {
        this.returnrefno = returnrefno;
    }

    @Column(name = "BILLINGWEIGHT", precision = 18, scale = 8)
    public Double getBillingweight() {
        return this.billingweight;
    }

    public void setBillingweight(Double billingweight) {
        this.billingweight = billingweight;
    }

    @Column(name = "STANDARDWEIGHT", precision = 18, scale = 8)
    public Double getStandardweight() {
        return this.standardweight;
    }

    public void setStandardweight(Double standardweight) {
        this.standardweight = standardweight;
    }
}
